package com.meiyu.live.ui.mine;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.meiyu.live.BaseActivity;
import com.meiyu.live.R;

/**
 * Created by zbl on 2017/1/20.
 * 关于界面
 */
public class AboutActivity extends BaseActivity implements View.OnClickListener {
    private View btn_back;
    private TextView tv_versionname;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);
        init();
    }

    private void init() {
        btn_back = findViewById(R.id.btn_back);
        btn_back.setOnClickListener(this);
        tv_versionname = (TextView) findViewById(R.id.tv_versionname);
        PackageManager packageManager = getPackageManager();
        PackageInfo packageInfo;
        try {
            packageInfo = packageManager.getPackageInfo(getPackageName(), 0);
            tv_versionname.setText("版本：" + packageInfo.versionName);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onClick(View view) {
        if (view == btn_back) {
            finish();
        }
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }
}
